import store from '@/store'

var tokenKey = 'access_token'

export function getToken() {
  return localStorage.getItem(tokenKey) || sessionStorage.getItem(tokenKey) || store.getters.token
}

export function setToken(token, remberMe) {
  if (remberMe) {
    localStorage.setItem(tokenKey, token)
  } else {
    sessionStorage.setItem(tokenKey, token)
  }
}

export function removeToken() {
  localStorage.removeItem(tokenKey)
  sessionStorage.removeItem(tokenKey)
}
